UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'toemoQCxakGOOj5G5ajtjbP2dZwrEVvGNKGS7kfKWS4=' 
WHERE 
  key_id = '9f9713a5c9f00d535067361b44a157223f9ff4cfeb9386baaf766d178d2664ac' 
  AND (
    token = 'toemoQCxakGOOj5G5ajtjbP2dZwrEVvGNKGS7kfKWS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023