UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yYBxAoBnYQYfGTRtvRanE+DEE8ebB4+D0gKARi3KnWI=' 
WHERE 
  key_id = '765854328d792474f73f12d8a3124d496a914ffc014b129b1f14a0776a477739' 
  AND (
    token = 'yYBxAoBnYQYfGTRtvRanE+DEE8ebB4+D0gKARi3KnWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028