UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e9rB0C98KQ9mKd+h8waW4eYeL7l8S1unODWkBPlZZUc=' 
WHERE 
  key_id = '8852bd75d4b48931b7f7654807d9c3014583585f3e66efd7f7af8fdd6a0d0005' 
  AND (
    token = 'e9rB0C98KQ9mKd+h8waW4eYeL7l8S1unODWkBPlZZUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022