UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3hNmORJEeFx/W8ZDwajlUQ799Cb/VhD6+El77ZET/8Q=' 
WHERE 
  key_id = '416dc5defcd63bb275daffef3206cba6543d379f3580a921ebe4ea894271cb49' 
  AND (
    token = '3hNmORJEeFx/W8ZDwajlUQ799Cb/VhD6+El77ZET/8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032