UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FbATfX5mRciiC6v4q0gw1uFsl+R4WULR+V+SM+48BSE=' 
WHERE 
  key_id = 'fae2a174563e528c9a8a35e40acd2fa554e096a3e9cb4caadf859243ae1be1c8' 
  AND (
    token = 'FbATfX5mRciiC6v4q0gw1uFsl+R4WULR+V+SM+48BSE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032