UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x7qevA7RWrzexf5QjHRXe02kgr2dPas3TzbBRJrpAiA=' 
WHERE 
  key_id = 'f5c04ab4ffc9a075641658e7d8279aac790ffe64208a6593c7e3a6eaa989c44d' 
  AND (
    token = 'x7qevA7RWrzexf5QjHRXe02kgr2dPas3TzbBRJrpAiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031