UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O/JvoFvEwhZ+giceHtOPct2sskvEJqmgdPFsPcGl19M=' 
WHERE 
  key_id = '146a273be768a844686867ffa86f231aa9f793569050f3a5d3496b6af74f858e' 
  AND (
    token = 'O/JvoFvEwhZ+giceHtOPct2sskvEJqmgdPFsPcGl19M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031