UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qXefV7qgkiTjlOsfpgGWXuX+dDgVZFMYJIMJsUcAI4k=' 
WHERE 
  key_id = 'd0e9124bb48cfee75549d22db50aa4f3b9e368c3f4e1a38c176a942d5809f36c' 
  AND (
    token = 'qXefV7qgkiTjlOsfpgGWXuX+dDgVZFMYJIMJsUcAI4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026