UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IbsZMKCEPWhrX3OQRyxQrBm4ZpbBLByy+ejxIge86KU=' 
WHERE 
  key_id = 'afa1f71bd570493c16421f97833a081ac2b1f655cf15da54ad43390eecc68c77' 
  AND (
    token = 'IbsZMKCEPWhrX3OQRyxQrBm4ZpbBLByy+ejxIge86KU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030