UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cgwe4M1qEjr0lCtcV2BRwu5zqtBQwyzQnqyc4mJGbVs=' 
WHERE 
  key_id = '7a7d136b71624d18ac61c6d39b7f3ee021e95bb9b68f276818553102e0e05c46' 
  AND (
    token = 'Cgwe4M1qEjr0lCtcV2BRwu5zqtBQwyzQnqyc4mJGbVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036