UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aHYQWXiH36BGAq8Bi9yeTfEqK8kXW/coJKKUoGC32Sc=' 
WHERE 
  key_id = 'c647ffdd5390155a4ad1509c7216fd679934a87d6f22fc98d933509786e0bc97' 
  AND (
    token = 'aHYQWXiH36BGAq8Bi9yeTfEqK8kXW/coJKKUoGC32Sc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035