UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYEuEYAfnmjskWOBraQhJmtqannYwTr1veBSuitXpdQ=' 
WHERE 
  key_id = '5fca922dc6e6b41a1740fe9f68dd26604fd3c50995e7a2482d355cccaaf37d38' 
  AND (
    token = 'fYEuEYAfnmjskWOBraQhJmtqannYwTr1veBSuitXpdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031