UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2/7gk8F3wtPmg7MtBLwZs/XuCCTEPFvBRufYKitjppY=' 
WHERE 
  key_id = '3b8428cbc50f90addca7a1faa03c6d45fb3b575a60d77e5203f19c3535f904a2' 
  AND (
    token = '2/7gk8F3wtPmg7MtBLwZs/XuCCTEPFvBRufYKitjppY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034