UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z6TcHJ34dfxIOyoGLiUv/IT8mreMFnsweT/knplAzfc=' 
WHERE 
  key_id = 'f97c012724661cd03c60aab145a51bc9b808df35ec17aa38f187509c1cf70580' 
  AND (
    token = 'Z6TcHJ34dfxIOyoGLiUv/IT8mreMFnsweT/knplAzfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052