UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ES6XqR7CkMapNT8oY5uKRTIaFc3TPesgEdEAYKjfouM=' 
WHERE 
  key_id = '7337081b4929f1b7214edaaeed85c923009f06c99053daa9e9b1d2ec6cc4118d' 
  AND (
    token = 'ES6XqR7CkMapNT8oY5uKRTIaFc3TPesgEdEAYKjfouM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030