UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VE2iuOcOMQLAQCNtQI6nGf8sOtI4Mdxtw8jTFNTKoI8=' 
WHERE 
  key_id = '0deda80ff31efd15693fba8d2b2b9a9a59b66eb7d06f84bf22bffb760a92a259' 
  AND (
    token = 'VE2iuOcOMQLAQCNtQI6nGf8sOtI4Mdxtw8jTFNTKoI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032