UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1P7AuBc6yV703+SG7StS89ItPth9L1VCEmLL7JAdKM=' 
WHERE 
  key_id = 'd6f36d4dc8237d7e69a383d33086ea6f6faeb81bd5fa0a3e32eefa3ccefec4f8' 
  AND (
    token = 'k1P7AuBc6yV703+SG7StS89ItPth9L1VCEmLL7JAdKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076