UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nDLstiY9hTcoOBFMg8qXJYwTXRJGjJGPLVh/RgZJ3VM=' 
WHERE 
  key_id = '66b34548779f77f30625024bb9e626cc023f516d08295b10a9ed92b3673cf7c4' 
  AND (
    token = 'nDLstiY9hTcoOBFMg8qXJYwTXRJGjJGPLVh/RgZJ3VM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043