UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bn6v5hjoFfkffWE4mgBZFiLOzhX+FkugxtB4IiGj0ZU=' 
WHERE 
  key_id = '2b6b222ca0c759146a343b647bfc2562a2b46e3e8713384510602befc35ac44a' 
  AND (
    token = 'bn6v5hjoFfkffWE4mgBZFiLOzhX+FkugxtB4IiGj0ZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030