UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IHZt0y2H/W9pLV/F9/c73CgFiCOKSt4EZLsN/6ReQL4=' 
WHERE 
  key_id = '50c5dade142d1f279d779594cf02ce296b946ee20722d7a87221030be2ac0469' 
  AND (
    token = 'IHZt0y2H/W9pLV/F9/c73CgFiCOKSt4EZLsN/6ReQL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032