UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X9eQPj/CseNrLvl7WWS7OCaXN4Uyu5uG9Pyauo4lPvA=' 
WHERE 
  key_id = 'bedf64f7f2ab3d6045f7c23e2b6848a6ea990f1b0e4debd60121140fba49d47d' 
  AND (
    token = 'X9eQPj/CseNrLvl7WWS7OCaXN4Uyu5uG9Pyauo4lPvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049