UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dZbZMP79p22csffFkBXat6hnAvLYwULTzM+Bb+ta8rk=' 
WHERE 
  key_id = '9a4bc35fd6dc517f4619e7734441fdbf0bdf65faf62eaa97daab8ccd5f2f0349' 
  AND (
    token = 'dZbZMP79p22csffFkBXat6hnAvLYwULTzM+Bb+ta8rk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039