UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qZ5scii4JVGEdJgsmqwC4SCOXIEFEfhLv+CkOuukv2k=' 
WHERE 
  key_id = '3696a14b2069a4343a4dd9c398bd877eee507427956129e69a5420f01ba8498f' 
  AND (
    token = 'qZ5scii4JVGEdJgsmqwC4SCOXIEFEfhLv+CkOuukv2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00126