UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fJn8AdyMWuSTGlG+/Np79l4vWbNhaufCGzr4ATs8oZU=' 
WHERE 
  key_id = 'b896ce951188d9edcd0b5967833be14804f62f5f317de38cd3e051310c6dda02' 
  AND (
    token = 'fJn8AdyMWuSTGlG+/Np79l4vWbNhaufCGzr4ATs8oZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044