UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZDSxxJIDI2pv6yWuY+LSFg81+yaTQKWw4viQdn1Xtj4=' 
WHERE 
  key_id = 'e0cb8addb18948bd8e6acbe3ca49f8a497f96ef323baa25d089c9fdce388f12d' 
  AND (
    token = 'ZDSxxJIDI2pv6yWuY+LSFg81+yaTQKWw4viQdn1Xtj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024