UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'myLvWOvL6cRPykMTHhAVgWl88cwN5KjOukQELgMw/GA=' 
WHERE 
  key_id = 'f83a44985ac14b840edd4931660d783259a77da0856826a40f639171d4c54f72' 
  AND (
    token = 'myLvWOvL6cRPykMTHhAVgWl88cwN5KjOukQELgMw/GA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023