UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YxIBH8+BX/qWTGmNsJsz9/rJ3Dp20Gxtxe+ktgnh3Bo=' 
WHERE 
  key_id = 'd1d6a81c1970586003ada04668ba40856c5bc1b1a4c1ddccdbec9fcc9c5a65c4' 
  AND (
    token = 'YxIBH8+BX/qWTGmNsJsz9/rJ3Dp20Gxtxe+ktgnh3Bo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021