UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cngr1IfS5xQHWSDAE0JpbBkYlz18+Zv5iAGhXj8Th7g=' 
WHERE 
  key_id = '781abc99bb9a7573d474dbdf534f12a98eec1c08fc25b4857ada4251c6ea9d86' 
  AND (
    token = 'Cngr1IfS5xQHWSDAE0JpbBkYlz18+Zv5iAGhXj8Th7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060