UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IZwUUyW9crtj+4oSUU8uO6NLCX5K2osybvIeNwzFEvU=' 
WHERE 
  key_id = '644038d9a926a802521ddf8cb710199e751c8e9137bb5cce73fa4d1598a014e2' 
  AND (
    token = 'IZwUUyW9crtj+4oSUU8uO6NLCX5K2osybvIeNwzFEvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033