UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4CdubXcNupNAvOm73ZRj1b1CC1+yEY+ESZyrduN6GBo=' 
WHERE 
  key_id = '164c15c354e117445700d9573f995b71e4ccfc5e6cf0c830d55bf5d7067cc409' 
  AND (
    token = '4CdubXcNupNAvOm73ZRj1b1CC1+yEY+ESZyrduN6GBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028