UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ArX7vC+RoE7/CPbk/SsY9jeH7WTRWd0No3IRg+dFzI0=' 
WHERE 
  key_id = '5dfd98b27d36f67f5faaec9ea49a83e16a672d13b2abb9f2880b2c58289e9955' 
  AND (
    token = 'ArX7vC+RoE7/CPbk/SsY9jeH7WTRWd0No3IRg+dFzI0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032