UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r2dlcmA+wSc1SmOEIsUY2OLtnn5xEY6eV/JBU91WYzE=' 
WHERE 
  key_id = '2f29a1d7df3cf0c6e524ab69d8026489d8946c592e7e8d4629ff1c457ae76801' 
  AND (
    token = 'r2dlcmA+wSc1SmOEIsUY2OLtnn5xEY6eV/JBU91WYzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038