UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/Bmk7B6SzNH5SlNSTLzC2gHepTDsZvAxpMmd4yYOTM=' 
WHERE 
  key_id = '8504ebb2ca93e2d5a9b314383ed7bbebf63646ce77075824dc49721f1c96f64d' 
  AND (
    token = 'S/Bmk7B6SzNH5SlNSTLzC2gHepTDsZvAxpMmd4yYOTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044