UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WWRuWUwL4jf81Efx3RSsDrkhws+tghE+ycSml85C3vY=' 
WHERE 
  key_id = '32db9c0c8b33e4a76d5cf8661b75edfa75f152615db08624e33c400f90979a28' 
  AND (
    token = 'WWRuWUwL4jf81Efx3RSsDrkhws+tghE+ycSml85C3vY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043