UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f9wWZwU0bMS/VkE+AY4MyymuiWfNehvc3A4T0AnKRgw=' 
WHERE 
  key_id = 'a69c883b88d12699089f04d77a2e406397df2562f23edfba4d41ec9cf818a84b' 
  AND (
    token = 'f9wWZwU0bMS/VkE+AY4MyymuiWfNehvc3A4T0AnKRgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045