UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hxuMGlOpxCi8sygyy1R+unlVhdsaQWKGxK4CxxvjR+0=' 
WHERE 
  key_id = '7b832ab4cdd6c0a349b44de4a10b93556d12234268135cd8c16b160788e42522' 
  AND (
    token = 'hxuMGlOpxCi8sygyy1R+unlVhdsaQWKGxK4CxxvjR+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028