UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'isVhmHVoK6lroREQWU8bB4dE30XzdeCc9dczXmDQT5s=' 
WHERE 
  key_id = '1876985b4818c82132e1c1c78d74b418ae9d18b919659448286a0658cae30059' 
  AND (
    token = 'isVhmHVoK6lroREQWU8bB4dE30XzdeCc9dczXmDQT5s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049