UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JIas6MvRn2sUaf5AjQ/yhcUVBxrnlcKJ0g1rHC+TPDQ=' 
WHERE 
  key_id = '8dde703af873bd32c0e14d2ed5250fc319750abb7e3f18a422d9fd99c1c276d7' 
  AND (
    token = 'JIas6MvRn2sUaf5AjQ/yhcUVBxrnlcKJ0g1rHC+TPDQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028