UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mONZKtqITbuutFoxfdNa1xyQDVdaFGzVfrycCkwMaLc=' 
WHERE 
  key_id = '38efae112fcba0fc5767d4bf40320d869dace387962572f7fde9f0c6bfb93786' 
  AND (
    token = 'mONZKtqITbuutFoxfdNa1xyQDVdaFGzVfrycCkwMaLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044