UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BtTm2nthFkc+z8a4A//3mzCZ0V+CiYELn6veU5vZ/Ic=' 
WHERE 
  key_id = 'efdd37f29cbe41d611622d7721e3ae2365e5b97b7dc35169bb1317a8ee24a6c3' 
  AND (
    token = 'BtTm2nthFkc+z8a4A//3mzCZ0V+CiYELn6veU5vZ/Ic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039