UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QoSH6fGo0CK4KiwsEMXp8nYsYxwpE72XzOZELHXgeEo=' 
WHERE 
  key_id = '29983ce3ba8adf49543e2cd01e0459853a337a0083903ffd257339fb83acaa8e' 
  AND (
    token = 'QoSH6fGo0CK4KiwsEMXp8nYsYxwpE72XzOZELHXgeEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032